<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head> 
	<title>Videshop POS</title> 
	<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
	<f:view>
		<table border="0" cellpadding="0" cellspacing="10">
			<tr>
				<td colspan="2"><h1>Videoshop POS</h1></td>
			</tr>
			<tr>
				<td valign="top" class="mainSection">
					<h2>Test Data</h2>
					<c:choose>
						<c:when test="${empty testSection.customers}">
							<span class="infoMessage">Click "Populate" to populate master data</span>
							<h:form>
								<h:commandLink styleClass="longButton" action="#{testSection.populate}">
									<f:verbatim escape="true">Populate</f:verbatim>
								</h:commandLink>
							</h:form>
						</c:when>
						<c:otherwise>
							<span class="infoMessage">Data populated sucessfully.</span>
							<br/>
							<span class="infoMessage">Click "Populate" to populate rental data</span>
							<h:form>
								<h:commandLink styleClass="longButton" action="#{testSection.populateRental}">
									<f:verbatim escape="true">Populate</f:verbatim>
								</h:commandLink>
							</h:form>
							<h3>Customers</h3>
							<h:dataTable  
											styleClass="dataTable"
											value="#{testSection.customers}"
											var="customer"
							>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Id</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{customer.customerId}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">First Name</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{customer.firstName}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Last Name</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{customer.lastName}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">User Name</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{customer.userName}"
									/>
								</h:column>
							</h:dataTable>
							
							<h3>Staffs</h3>
							<h:dataTable 
											styleClass="dataTable"
											value="#{testSection.staffs}"
											var="staff"
							>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">First Name</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{staff.firstName}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Last Name</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{staff.lastName}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">User Name</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{staff.userName}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">User Role</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{staff.role}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Store</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{staff.store.storeName}"
									/>
								</h:column>
							</h:dataTable>
							
							
							<h3>Title Copy</h3>
							<h:dataTable 
											styleClass="dataTable"
											value="#{testSection.copies}"
											var="copy"
							>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Id</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{copy.titleCopyId}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Format</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{copy.medium.mediumType}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">title</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{copy.medium.title.titleName}"
									/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim escape="true">Store</f:verbatim>
									</f:facet>
									<h:outputText
													value="#{copy.store.storeName}"
									/>
								</h:column>
							</h:dataTable>
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
		</table>
	</f:view>
</html>